Revert "Revert "Fixed some stuff. Reading from files is with bugs.""

This reverts commit 6229b3c4b4d26c0bbbdf22176b941c294de55707.