cleanup

Condense some code