Improved Abstraction, fixed some bugs