Some little improvements and cleanup