Update: Cleaning up, optimization with code inspection