seperated functions and examples, made comparator example