Refactor source to a better layout

Yes, again -.-;