refactored function for getting type of box
no pointer
renamed method