Added memory allocation for the signal, and added/renamed some variables regarding the signal length.  Also updated some comments/general code cleanup.