Last commit before code clean-up, before adding comments and formatting. Next commits can contain errors. Testing is needed.