cleanup code a little bit