another slight redesign, cleaned up code a little bit