code cleaned and formatted