Added namespace, moved library to src

Also cleaned up some stray whitespace and formatted the latest functionality to
be in line with the rest of the file.