refactoring jaca code