code formated, cleaned up