Finished problem 4, consider not using standard libraries