code cleaned up a little