Modifed stuff
Extracted functions