a bit better mayhaps
attemps at better code