small optimalizations

might want to compile it before using :-) oh and a quick test