Adding a decorator for synchronizing methods