Got rid of unnecessary functions, handled with if clauses