reworking based on old XNA project