Refactor and cleanup for public release under CC. Lincese file and README will be added later