Refactored mapping extraction
Lines, bugfixes to restyling