Fixed untested code. Placeholders are mostly done