Return values, code format, bug fix

Changed functions to not return unless needed. Updated code format to be
cleaner. Fixed insert after and before bugs.