Move variable related code to own file