splitting method bodies for better readability and removing a bug
Moreover, fixed some TODOs / FIXMEs