Fixed wrong selection error.
Changed some structure (comments in code)