condense some code