minor code refactoring, GC checks