some better code organization