Fix import path and minor refactoring