Added logging framework
Cast to integer fixed