General clean-up

Also added BSD license to every file