created function for adding and
added sort to function
ignore
adjusted function for is readable