clean up code, separated test