small fix in return and some cleanup