Minor bugfixes and improvements. Need to fix session timeout error.