Interface fix, and refactoring code