changes to better organize the code