Working options -p and gui
Option -lt working
Minor refactorings