more code cleaned up