added the alarm into code, also fixed a few other things