Moving some source code to respect the mvc design pattern

Signed-off-by: Benoit Brayer <brayer.benoit@gmail.com>