tried to made it more functional