improve and cleanup