A bit of refactoring of some functions. Split them into multiple functions. Currently empty - gotta be filled.