cleanup code slightly