more dynamic code

Replaced a few constants with "sizeof" methods to make the code more
dynamic.