Fixed bugs. Added some features