Finished! Missing power of two padding, but I'm too lazy for that