Some usability improvements and code cleaning