functionized main, added full search recording
Added return variable, renamed main