Finalizing Arduino code

Shortened the code and added comments where they were missing.