refactored

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
added proper content guards

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>