added main method for testing and fixed a few typo-bugs