Minor tweaks, still needs to be debugged