Made a generic method to replaces multiple similar methods