Cleaned up repeated functions