main updated to fix bugs, code modified to communicate with bluetooth