merged with frontend
Minor refactoring