Nawqaan 125

This is a partial implementation of the referenced ticket, however it is a major refactoring, so I think it merits review now.