many bug fixes, catalogue refactoring