JS refactored a bit, trying to make inclnudes more modular