needs some more fixes to make it neater