class method decorator to save repetitive code