Add license, general formatting, etc

Added licensed, general formatting, bugfix for primary key, added format