split functions into dedicated files, 
added changed area detection