refactoring runtime function calls and cleanup some comments