added midi commons file, moved some code around to make better sense