Refactoring, optimizations

Changed interval to send data every 30s, refactoring, comments.