Changed the implementation. I believe this is a better approach.