Combined all functions into 1 method