Tried to simplify code.