Refactor task decorator, now works with methods