Removed unwanted code, fixed bugs, added regular expression based query parsing