Splitted a function in 2 functions for code clarity. Not sure if it works :-/