Improving some existing code to be reusable and implementing relations between tables.