clean code and added layer to work on top of livestatus