cleaned up the init code a bit