clean up code and fix divide by 0 error