Code and comment clean up. Renamed two internally used functions to better follow conventions. Add todo's.
Errors are errors, log them as such.
Fix memory issues after profiles batch import by using special table for caching instead variables table
Add todo's.
Removed unused code.
Introduced ability to get profile in JSON.
Improved error handling for text fields.
Code style improvements.