fixed some bugs, used decorators