Cleaned up code and fixed warnings and typos.
Signed-off-by: Trevor Nielsen