code re-factoring

- improve code style;
- update license headers;
- done issue #356