Clening up some code