code cleaned a bit