Rewrote implementation to use default values and one simple function that does all the work