cleaned and formated code