Streamlined code

Streamlined the code to remove repetition with the new functions
bruteInsert() and setAlert(). Reduced the file size by about 10%.