review and cleanup code