much better code