added a bunch of tests and fixed bugs related to ^, $