Thanks to:
Klonan: for fixing some code