Added tests. Fixed bug in structs.