More refactoring. Started on custom-prompt