Refactor and refresh functionality.
Small fixes for gcc.