Before functions Added

(Not Tested) Added ability to have one before function with parameters. Also added error logs for this feature.