Finished refactoring ... not working yet.