Core: Fix warnings and some cleanup