better code arrangement