cleanups, refactored repetitive stuffs