Making bin function work...still not finished.