add more core functions; +minor refactoring