Improved behaviour of states in VPL, fixed many minor bugs.