Converted switch statement to methods